<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html>
<html lang="zh-CN">
  
  <head>
    
    <%@ include file="/WEB-INF/include/meta.jsp"%>
    <%@ include file="/WEB-INF/include/css.jsp"%>
    
  </head>
  <!-- end header -->
  <body>
    <div class="page-group">
        <div class="page page-current">
           
      <header class="bar bar-nav fs-header-small">
        <h1 class="title">代言人个人中心</h1>
      </header>
      <!-- end header -->

      <div class="content">
        <div class="profile-banner">
          <h5 class="text-center" style="margin: .5rem;">基本信息</h5>
          <div class="list-block info-list-item" style="margin: 0.5rem 0;">
            <ul>
              <li class="item-content">
                <div class="item-inner">
                  <div class="item-title">代言人姓名：</div>
                  <div class="item-after">${distributor.name}</div>
                </div>
              </li>
              <li class="item-content">
                <div class="item-inner">
                  <div class="item-title">手机号：</div>
                  <div class="item-after">${distributor.mobile}</div>
                </div>
              </li>
              <c:choose>
                <c:when test="${not empty distributor.webchatId}">
                  <li class="item-content">
                    <div class="item-inner">
                      <div class="item-title">打款账户：</div>
                      <div class="item-after">${distributor.webchatId}</div>
                    </div>
                  </li>
                  <li class="item-content">
                    <div class="item-inner">
                      <div class="item-title">账户类型：</div>
                      <div class="item-after">微信号</div>
                    </div>
                  </li>
                </c:when>
                <c:otherwise>
                  <li class="item-content">
                    <div class="item-inner">
                      <div class="item-title">打款账户：</div>
                      <div class="item-after">${distributor.account} &nbsp;-&nbsp; ${distributor.realName}</div>
                    </div>
                  </li>
                  <li class="item-content">
                    <div class="item-inner">
                      <div class="item-title">账户类型：</div>
                      <div class="item-after">支付宝</div>
                    </div>
                  </li>
                </c:otherwise>
              </c:choose>
              
            </ul>
          </div>
          <h5 class="text-center" style="margin: .5rem;">代言数据统计</h5>
          <div class="list-block info-list-item" style="margin: 0.5rem 0;">
            <ul>
              <li class="item-content">
                <div class="item-inner">
                  <div class="item-title">用户统计：</div>
                  <div class="item-after">${distributor.focusUser}人关注&nbsp;&nbsp;&nbsp;&nbsp;${distributor.purchaserTotal}人下单</div>
                </div>
              </li>
              <li class="item-content">
                <div class="item-inner">
                  <div class="item-title">奖励比例：</div>
                  <div class="item-after">${distributor.kickback}%</div>
                </div>
              </li>
              <li class="item-content">
                <div class="item-inner">
                  <div class="item-title">总赚：</div>
                  <div class="item-after">赚:<fmt:formatNumber value="${distributor.kickbackTotal/100}" maxFractionDigits="2" pattern="0.00"/>元</div>
                </div>
              </li>
              <li class="item-content">
                <div class="item-inner">
                  <div class="item-title">提现：</div>
                  <div class="item-after">待打款:<fmt:formatNumber value="${distributor.withdrawingTotal/100}" maxFractionDigits="2" pattern="0.00"/>元
                  &nbsp;&nbsp;&nbsp;&nbsp;已打款:
                  <fmt:formatNumber value="${distributor.withdrawedTotal/100}" maxFractionDigits="2" pattern="0.00"/>元</div>
                </div>
              </li>
            </ul>
          </div>
          
          <div class="list-block info-list-item" style="margin: .5rem 0;">
            <p style="margin:1em;">
              <c:choose>
                <c:when test="${(not empty distributor.account && not empty distributor.realName) || (not empty distributor.webchatId)}">
                  <a href="#distributor-withdraw" class="button button-big button-success button-fill button-submit" data-toggle="push" style="width:100%; background-color:#FDDD32;color:#000;">提现</a>
                </c:when>
                <c:otherwise>
                  <a href="#account-edit" class="button button-big button-danger button-fill button-submit"  data-toggle="push" style="width:100%; color:#fff;"> 请填写支付宝账号或微信号</a>
                </c:otherwise>
              </c:choose>
            </p>
          </div>
          
          <h5 class="text-center" style="margin: .5rem;">代言二维码</h5>
          <div class="list-block info-list-item" style="margin: 0.5rem 0; text-align: center;">
            <img src="${cloud.prod}/${distributor.qrcode}" style="width: 8rem; height: 8rem;">
            <p class="text-center" style="color:#999; font-size: .6rem;">长按保存二维码用于分享</p>
          </div>
          
        </div>
    </div>

  <%@ include file="/WEB-INF/include/script.jsp"%>
  <d:resource type="script" root="${ctx.resource}/build" src="js/page/profile/distributor.js" />
    <script type="text/javascript">
      var jsConfig = JSON.parse('${wechatJsConfig}')
      require(['page/profile/distributor'], function(page) {
        page.init({
          jsConfig: jsConfig
        })
      })
    </script>
  </body>
</html>
